package util.comparator;

import java.text.Collator;
import java.util.Comparator;

import data_stuct.Entry;

/**
 * implementation of comparator by class number
 * 
 * @author Majid Mallis
 * 
 */
public class ComparatorByClass implements Comparator<Entry> {

	public ComparatorByClass() {
		super();
	}

	public int compare(Entry e1, Entry e2) {
		String s1 = new String(e1.CENT_RES);
		String s2 = new String(e2.CENT_RES);

		// if classes are the same, we compare activity centers
		if (s1.equals(s2)) {
			String s3 = new String(e1.CENT_ACT);
			String s4 = new String(e2.CENT_ACT);

			return Collator.getInstance().compare(s3, s4);
		}

		return Collator.getInstance().compare(s1, s2);
	}
}